using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShivamEMR.Model.Domain.PatientDomain;
using ShivamEMR.Model.DataInterfaces.PatientDataInterf;
using ShivamEMR.Model;
//using ShivamEMR.Web.Areas.Patient.Models;

namespace ShivamEMR.Web.Areas.Patient.Controllers
{   
    public class AdmissionStatusController : Controller
    {
		private readonly IAdmissionStatusRepository admissionstatusRepository;

		// If you are using Dependency Injection, you can delete the following constructor
        public AdmissionStatusController()
        {
            admissionstatusRepository = Registry.RepositoryFactory.GetAdmissionStatusRepository();
        }

        public AdmissionStatusController(IAdmissionStatusRepository admissionstatusRepository)
        {
			this.admissionstatusRepository = admissionstatusRepository;
        }

        //
        // GET: /AdmissionStatus/

        public ViewResult Index()
        {
        //    return View(admissionstatusRepository.AllIncluding(admissionstatus => admissionstatus.Admissions));
            return View(admissionstatusRepository.All);
        }

        //
        // GET: /AdmissionStatus/Details/5

        public ViewResult Details(int id)
        {
            return View(admissionstatusRepository.Find(id));
        }

        //
        // GET: /AdmissionStatus/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /AdmissionStatus/Create

        [HttpPost]
        public ActionResult Create(AdmissionStatus admissionstatus)
        {
            if (ModelState.IsValid) {
                admissionstatusRepository.InsertOrUpdate(admissionstatus);
                admissionstatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }
        
        //
        // GET: /AdmissionStatus/Edit/5
 
        public ActionResult Edit(int id)
        {
             return View(admissionstatusRepository.Find(id));
        }

        //
        // POST: /AdmissionStatus/Edit/5

        [HttpPost]
        public ActionResult Edit(AdmissionStatus admissionstatus)
        {
            if (ModelState.IsValid) {
                admissionstatusRepository.InsertOrUpdate(admissionstatus);
                admissionstatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }

        //
        // GET: /AdmissionStatus/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View(admissionstatusRepository.Find(id));
        }

        //
        // POST: /AdmissionStatus/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            var astatus = admissionstatusRepository.Find(id);
            admissionstatusRepository.Delete(astatus);
            admissionstatusRepository.Save();

            return RedirectToAction("Index");
        }
    }
}

